package com.jz.beijianbao.legalperson.mapper;

import com.jz.beijianbao.legalperson.bean.LegalPerson;
import com.jz.beijianbao.legalperson.bean.LegalPersonAdd;
import com.jz.beijianbao.legalperson.bean.PlantSelectVo;
import com.jz.beijianbao.legalperson.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface LegalPersonMapper {


    List<PlantSelectVo> queryPage(PlantSelectVo plantSelectVo);


    int count(PlantSelectVo plantSelectVo);

    LegalPersonAdd queryByCode(LegalPersonAdd legalPersonAdd);

    @Insert("insert into LegalPerson (legalPersonName,legalPersonCode,status,userId,createTime,createName)" +
            "values (#{legalPersonName},#{legalPersonCode},#{status},#{userId},#{createTime},#{createName})")
    void addPlant(LegalPerson legalPlantVo1);

    @Update("update LegalPerson set legalPersonName = #{legalPersonName},status = #{status},updateName = #{updateName}," +
            "updateTime = #{updateTime},version = #{version}+1 where id = #{id} and version=#{version}")
    int updatePlant(LegalPerson legalPerson);

    @Update("update LegalPerson set status = #{status}," +
            "updateName = #{updateName},updateTime = #{updateTime} where id = #{id}")
    void updateStatus(LegalPerson legalPlant1);

    @Select("select * from user")
    List<User> queryXiaLa();
}
